//
//  SXVideoDetailListTableViewCell.m
//  ShiXun
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 张琪. All rights reserved.
//

#import "SXVideoDetailListTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation SXVideoDetailListTableViewCell

+ (CGFloat)heightForCell
{
    return 777 * kScreenWidth / 1242 - 60;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _detailImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 777 * kScreenWidth / 1242)];
        [self.contentView addSubview:_detailImageView];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _detailImageView.centerY - 30, kScreenWidth, 30)];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:17 weight:15];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [_detailImageView addSubview:_titleLabel];
        
        _durationLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _detailImageView.centerY, kScreenWidth, 25)];
        _durationLabel.textColor = [UIColor whiteColor];
        _durationLabel.font = [UIFont systemFontOfSize:15 weight:15];
        _durationLabel.textAlignment = NSTextAlignmentCenter;
        [_detailImageView addSubview:_durationLabel];
        
        self.layer.masksToBounds = YES;
    }
    return self;
}

- (void)setConfigureModel:(SXVideoDetailModel *)configureModel
{
    _configureModel = configureModel;
    
    [_detailImageView sd_setImageWithURL:[NSURL URLWithString:configureModel.coverForDetail] placeholderImage:[UIImage imageNamed:@"SX-placeholder"]];
    _titleLabel.text = configureModel.title;
    _durationLabel.text = [NSString stringWithFormat:@"#%@ / %@", configureModel.category,configureModel.durationTime];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
